Rem
	Blitzprog GUI
	
	(C) Eduard Urbach
End Rem

' Strict
SuperStrict

' You need this in order to use the Blitzprog Precompiler
'Import BRL.Retro

' Files
Import "TGUI.bmx"

' Set root dir for skin files
FS_ROOT = "../../"

' Window
SetGraphicsDriver GLMax2DDriver()
Graphics 1024, 768

' Create a game
Local gui:TGUI = TGUI.Create()

Local win:TWindow = TWindow.Create("win", "Title", 0, 0, 0, 0)
gui.root.Add(win)

win.SetPosition(0.25, 0.25) 
win.SetPositionAbs(100, 100)
win.SetSizeAbs(0, 0)
win.SetSize(0.5, 0.5) 

Local group1:TGroup = TGroup.Create("group1", "Group 1")
group1.SetSize(1.0, 0.5)
group1.SetPosition(0, 0) 
group1.SetColor(255, 128, 0)
win.Add(group1) 

Local group2:TGroup = TGroup.Create("group2", "Group 2")
group2.SetSize(1.0, 0.5) 
group2.SetPosition(0, 0.5) 
group2.SetColor(0, 128, 255)
win.Add(group2)

Local txt:TTextField = TTextField.Create("txt", "MyText", 5, 5)
txt.SetSize(0.5, 0)
txt.SetSizeAbs(0, 24)
group2.Add(txt)

SetBlend ALPHABLEND

' Main loop
While AppTerminate() = 0 And KeyDown(KEY_ESCAPE) = 0
	Cls
	
	TInputSystem.Update()
	gui.Update()
	gui.Draw()
	
	DrawText "Abs: " + win.cAbs.ToString(), 5, 5
	DrawText "Rel: " + win.cRel.ToString(), 5, 25
	
	DrawText "root.rX: " + gui.root.rX, 5, 45
	DrawText "root.rY: " + gui.root.rY, 5, 65
	DrawText "root.rWidth: " + gui.root.rWidth, 5, 85
	DrawText "root.rHeight: " + gui.root.rHeight, 5, 105
	DrawText "root.cRel: " + gui.root.cRel.ToString(), 5, 125
	
	DrawText "Win.padding: " + win.padding.ToString(), 5, 145
	DrawText "Win.rWidth: " + win.rWidth, 5, 165
	DrawText "Win.rHeight: " + win.rHeight, 5, 185
	DrawText "Win.relOffset.x: " + win.GetRelOffsetX(), 5, 205
	DrawText "Win.relOffset.y: " + win.GetRelOffsetY(), 5, 225
	
	DrawText "Cursor: " + txt.cursorStart, 5, 265
	DrawText "CursorEnd: " + txt.cursorEnd, 5, 285
	
	Flip 0
Wend

' Quit
End

